﻿<?xml version="1.0" encoding="UTF-8"?>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<h2>Registrieren</h2>
<p>Bitte f&uuml;llen Sie das untenstehende Formular aus!</p>
<h:form>
<h3>Pers&ouml;nliche Daten</h3>
<div class="formblock">
	<fieldset>
		<div>
			<h:outputLabel styleClass="Float" for="firstname" value="Vorname"/>
           	<h:inputText id="firstname"
				required="true"  requiredMessage="bitte angeben" 
				value="#{FormPlayer.firstName}"/>
			<span class="message">&nbsp;<h:message for="firstname"/></span>
		</div>
		<div>
			<h:outputLabel styleClass="Float" for="lastname" value="Nachname"/>
			<h:inputText id="lastname" 
				required="true"  requiredMessage="bitte angeben" 
				value="#{FormPlayer.lastName}"/>
			<span class="message">&nbsp;<h:message for="lastname"/></span>
		</div>
		<div>
			<h:outputLabel styleClass="Float" for="dateofbirth" value="Geburtsdatum"/>
			<h:inputText id="dateofbirth" required="true"
		       requiredMessage="bitte angeben"
		       value="#{FormPlayer.dateOfBirth}"
		       converterMessage="ungültiges Datum/Format (TT.MM.JJJJ)"
			   validator="#{RegisterController.validateBirthDate}"
			   validatorMessage="das Datum ist nicht gültig" >
				<f:convertDateTime pattern="dd.MM.yyyy"/>
			</h:inputText>
	    	<span class="message">&nbsp;<h:message for="dateofbirth"/></span>
		</div>
		<div>
			<h:outputLabel styleClass="Float" for="sex" value="Geschlecht"/>
	    	<h:selectOneMenu id="sex" value="#{FormPlayer.gender}">
				<f:selectItem itemLabel="männlich" itemValue="MALE" />
				<f:selectItem itemLabel="weiblich" itemValue="FEMALE" />
			</h:selectOneMenu>	
	    </div>
	</fieldset>
</div>
	
<h3><span xml:lang="en">Login</span> Daten und Gr&ouml;&szlig;e des <span xml:lang="en">Stack</span></h3>
<div class="formblock">
	<fieldset>
		<div>
			<h:outputLabel styleClass="Float" for="username" value="Username"/>
			<h:inputText id="username" required="true"
				requiredMessage="bitte angeben"
				value="#{FormPlayer.userName}"
				validator="#{RegisterController.validateUsername}"
				validatorMessage="Username existiert bereits" />
			<span class="message">&nbsp;<h:message for="username"/></span>
		</div>
		<div>
			<h:outputLabel styleClass="Float" for="password" value="Passwort"/>
			<h:inputSecret id="password" required="true"
		       requiredMessage="bitte angeben" 
		       value="#{FormPlayer.password}" />
		    <span class="message">&nbsp;<h:message for="password" style="color:red"/></span>   
		</div>
		<div>
			<h:outputLabel styleClass="Float" for="stack" value="Größe des Stack"/>
			<h:inputText id="stack" required="true"
		       requiredMessage="bitte angeben"
		       value="#{FormPlayer.stack}"
		       converterMessage="es sind nur Zahlen erlaubt"
			   validator="#{RegisterController.validateStack}"
			   validatorMessage="Stackgröße muss min. 1000 € betragen" />
			<span class="message">&nbsp;<h:message for="stack"/></span>
		</div>
	</fieldset>
</div>
<div id="buttons">
	<h:commandButton action="#{RegisterController.register}" value="Registrieren" accesskey="r"/>
</div>
</h:form>